package com.example.service.impl;

import com.example.service.SysPermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

@Slf4j
@Service
public class SysPermissionServiceImpl implements SysPermissionService {

    @Override
    @Cacheable(value = "permission", key = "'user:' + #userId")
    public List<String> getUserPermissions(Long userId) {
        // 实际项目中，应该从数据库中查询用户权限
        // 这里仅作为示例，返回模拟数据
        log.info("获取用户权限列表，userId: {}", userId);
        return Arrays.asList("sys:user:page", "sys:user:info", "sys:user:save", "sys:user:update", "sys:user:delete");
    }
} 